package com.stylefeng.thanks.jwt;

import com.stylefeng.thanks.core.util.JwtTokenUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;

/**
 * @program: thanks_api
 * @description: JWT 生成
 * @author: yifanzhu
 * @create: 2018-12-05 11:04
 **/
public class JwtGenerate {

    final String userId = "userId";

    private final Log logger = LogFactory.getLog(this.getClass());

    @Test
    public void jwtgenerate(){
        String jwt = JwtTokenUtil.generateToken(String.valueOf(userId));
        logger.info("++++++++++++++++++++++jwt++++++++++++++\n" + "Bearer " + jwt);

        boolean flag = JwtTokenUtil.isTokenExpired(jwt);
        logger.info("======================================\n" +flag);
    }
}
